#城市分布


from pyecharts import options as opts
from pyecharts.charts import Bar
from pyecharts.faker import Faker
import pandas as pd
df=pd.read_csv("二手车基本信息.csv")
city_num = df['城市'].value_counts().tolist()[:10]
city_type = df['城市'].value_counts().index.tolist()[:10]
c = (
    Bar()
        .add_xaxis(city_type)
        .add_yaxis("城市", city_num, color=Faker.rand_color())
        .set_global_opts(
        title_opts=opts.TitleOpts(title="城市分布"),
        datazoom_opts=[opts.DataZoomOpts(), opts.DataZoomOpts(type_="inside")],
    )
        .render("bigdata/cardata/城市分布.html")

)

